package com.dianping.cat.home.router.entity;

import com.dianping.cat.home.router.BaseEntity;
import com.dianping.cat.home.router.IVisitor;
import java.util.LinkedHashMap;
import java.util.Map;







public class NetworkPolicy
  extends BaseEntity<NetworkPolicy>
{
  private String m_id;
  private String m_title;
  private boolean m_block = false;
  private String m_serverGroup;
/*  21 */   private Map<String, Network> m_networks = new LinkedHashMap();





/*  27 */   public NetworkPolicy(String id) { this.m_id = id; }




  public void accept(IVisitor visitor) { visitor.visitNetworkPolicy(this); }


  public NetworkPolicy addNetwork(Network network) {
    this.m_networks.put(network.getId(), network);
/*  37 */     return this;
  }


  public boolean equals(Object obj) {
/*  42 */     if (obj instanceof NetworkPolicy) {
/*  43 */       NetworkPolicy _o = (NetworkPolicy)obj;

/*  45 */       if (!equals(getId(), _o.getId())) {
/*  46 */         return false;
      }

/*  49 */       return true;
    }

/*  52 */     return false;
  }


/*  56 */   public Network findNetwork(String id) { return (Network)this.m_networks.get(id); }


  public Network findOrCreateNetwork(String id) {
/*  60 */     Network network = (Network)this.m_networks.get(id);

/*  62 */     if (network == null) {
/*  63 */       synchronized (this.m_networks) {
/*  64 */         network = (Network)this.m_networks.get(id);

/*  66 */         if (network == null) {
/*  67 */           network = new Network(id);
/*  68 */           this.m_networks.put(id, network);
        }
      }
    }

/*  73 */     return network;
  }


/*  77 */   public boolean getBlock() { return this.m_block; }



/*  81 */   public String getId() { return this.m_id; }



/*  85 */   public Map<String, Network> getNetworks() { return this.m_networks; }



/*  89 */   public String getServerGroup() { return this.m_serverGroup; }



/*  93 */   public String getTitle() { return this.m_title; }



  public int hashCode() {
/*  98 */     int hash = 0;

/* 100 */     return hash * 31 + ((this.m_id == null) ? 0 : this.m_id.hashCode());
  }




/* 106 */   public boolean isBlock() { return this.m_block; }



  public void mergeAttributes(NetworkPolicy other) {
/* 111 */     assertAttributeEquals(other, "network-policy", "id", this.m_id, other.getId());

/* 113 */     if (other.getTitle() != null) {
/* 114 */       this.m_title = other.getTitle();
    }

/* 117 */     this.m_block = other.getBlock();

/* 119 */     if (other.getServerGroup() != null) {
/* 120 */       this.m_serverGroup = other.getServerGroup();
    }
  }


/* 125 */   public Network removeNetwork(String id) { return (Network)this.m_networks.remove(id); }


  public NetworkPolicy setBlock(boolean block) {
/* 129 */     this.m_block = block;
/* 130 */     return this;
  }

  public NetworkPolicy setId(String id) {
/* 134 */     this.m_id = id;
/* 135 */     return this;
  }

  public NetworkPolicy setServerGroup(String serverGroup) {
/* 139 */     this.m_serverGroup = serverGroup;
/* 140 */     return this;
  }

  public NetworkPolicy setTitle(String title) {
/* 144 */     this.m_title = title;
/* 145 */     return this;
  }

  public NetworkPolicy() {}
}


/* Location:              /Users/hanfei/Documents/apache-tomcat-9.0.24/webapps/cat/WEB-INF/classes/!/com/dianping/cat/home/router/entity/NetworkPolicy.class
 * Java compiler version: 7 (51.0)
 * JD-Core Version:       1.0.7
 */